package cn.wolfcode.web.controller;

import cn.wolfcode.domain.Consumption;
import cn.wolfcode.domain.ConsumptionItem;
import cn.wolfcode.domain.SystemDictionary;
import cn.wolfcode.qo.ConsumptionQueryObject;
import cn.wolfcode.qo.JsonResult;
import cn.wolfcode.service.IBusinessService;
import cn.wolfcode.service.IConsumptionItemService;
import cn.wolfcode.service.IConsumptionService;
import cn.wolfcode.service.ISystemDictionaryService;
import cn.wolfcode.util.RequiredPermission;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/consumptionItem")
public class ConsumptionItemController {

    @Autowired
    private IConsumptionItemService consumptionItemService;

    @RequestMapping("/saveOrUpdate")
    @RequiredPermission(name="结算单明细编辑(无预约单)", expression = "consumptionItem:saveOrUpdate")
    @ResponseBody
    public JsonResult saveOrUpdate(ConsumptionItem item) {

        if (item.getId() == null) {
            consumptionItemService.save(item);
        } else {
            consumptionItemService.update(item);
        }
        return new JsonResult(true, "操作成功");
    }


}
